package com.miracle9.game.server.message;

import java.util.LinkedList;

public class StorageMethodOperating {

    private LinkedList<StorageMethodEntity> queue = new LinkedList();

    public synchronized void notifyAllOperating(StorageMethodEntity data) {
        this.queue.addFirst(data);
        notifyAll();
    }

    public synchronized StorageMethodEntity waitOperating() {
        try {
            while (this.queue.isEmpty()) {
                wait();
            }
        } catch (Exception e) {
            return null;
        }
        return this.queue.pollLast();
    }

}
